

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>pyamp.exceptions &mdash; pyamp v1.2 documentation</title>
    <link rel="stylesheet" href="../../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../',
        VERSION:     '1.2',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../_static/doctools.js"></script>
    <link rel="top" title="pyamp v1.2 documentation" href="../../index.html" />
    <link rel="up" title="Module code" href="../index.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li><a href="../../index.html">pyamp v1.2 documentation</a> &raquo;</li>
          <li><a href="../index.html" accesskey="U">Module code</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <h1>Source code for pyamp.exceptions</h1><div class="highlight"><pre>
<span class="c"># Copyright 2012 Brett Ponsler</span>
<span class="c"># This file is part of pyamp.</span>
<span class="c">#</span>
<span class="c"># pyamp is free software: you can redistribute it and/or modify</span>
<span class="c"># it under the terms of the GNU General Public License as published by</span>
<span class="c"># the Free Software Foundation, either version 3 of the License, or</span>
<span class="c"># (at your option) any later version.</span>
<span class="c">#</span>
<span class="c"># pyamp is distributed in the hope that it will be useful,</span>
<span class="c"># but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<span class="c"># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<span class="c"># GNU General Public License for more details.</span>
<span class="c">#</span>
<span class="c"># You should have received a copy of the GNU General Public License</span>
<span class="c"># along with pyamp.  If not, see &lt;http://www.gnu.org/licenses/&gt;.</span>
<span class="sd">&#39;&#39;&#39;The exceptions module contains definitions of common Exception</span>
<span class="sd">classes which are used throughout the pyamp project to indicate</span>
<span class="sd">errors to the programmer.</span>

<span class="sd">&#39;&#39;&#39;</span>
<span class="kn">from</span> <span class="nn">pyamp.util.objects</span> <span class="kn">import</span> <span class="n">getName</span>


<div class="viewcode-block" id="UndefinedPropertyError"><a class="viewcode-back" href="../../_generated/pyamp_exceptions.html#pyamp.exceptions.UndefinedPropertyError">[docs]</a><span class="k">class</span> <span class="nc">UndefinedPropertyError</span><span class="p">(</span><span class="ne">Exception</span><span class="p">):</span>
    <span class="sd">&#39;&#39;&#39;A class or object is missing a required property.&#39;&#39;&#39;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">obj</span><span class="p">,</span> <span class="n">propertyName</span><span class="p">):</span>
        <span class="sd">&#39;&#39;&#39;</span>
<span class="sd">        * obj -- The class or object</span>
<span class="sd">        * propertyName -- The name of the property that is required</span>

<span class="sd">        &#39;&#39;&#39;</span>
        <span class="n">message</span> <span class="o">=</span> <span class="s">&quot;Class [</span><span class="si">%s</span><span class="s">] is missing a required property: [</span><span class="si">%s</span><span class="s">]&quot;</span> <span class="o">%</span> \
            <span class="p">(</span><span class="n">getName</span><span class="p">(</span><span class="n">obj</span><span class="p">),</span> <span class="n">propertyName</span><span class="p">)</span>

        <span class="ne">Exception</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">message</span><span class="p">)</span>

</div>
<div class="viewcode-block" id="UndefinedFunctionError"><a class="viewcode-back" href="../../_generated/pyamp_exceptions.html#pyamp.exceptions.UndefinedFunctionError">[docs]</a><span class="k">class</span> <span class="nc">UndefinedFunctionError</span><span class="p">(</span><span class="ne">Exception</span><span class="p">):</span>
    <span class="sd">&#39;&#39;&#39;A class or object is missing a required function.&#39;&#39;&#39;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">obj</span><span class="p">,</span> <span class="n">functionName</span><span class="p">):</span>
        <span class="sd">&#39;&#39;&#39;</span>
<span class="sd">        * obj -- The class or object</span>
<span class="sd">        * functionName -- The name of the required function</span>

<span class="sd">        &#39;&#39;&#39;</span>
        <span class="n">message</span> <span class="o">=</span> <span class="s">&quot;Class [</span><span class="si">%s</span><span class="s">] is missing a required function: [</span><span class="si">%s</span><span class="s">]&quot;</span> <span class="o">%</span> \
            <span class="p">(</span><span class="n">getName</span><span class="p">(</span><span class="n">obj</span><span class="p">),</span> <span class="n">functionName</span><span class="p">)</span>

        <span class="ne">Exception</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">message</span><span class="p">)</span>

</div>
<div class="viewcode-block" id="FinalFunctionError"><a class="viewcode-back" href="../../_generated/pyamp_exceptions.html#pyamp.exceptions.FinalFunctionError">[docs]</a><span class="k">class</span> <span class="nc">FinalFunctionError</span><span class="p">(</span><span class="ne">Exception</span><span class="p">):</span>
    <span class="sd">&#39;&#39;&#39;The FinalFunctionError class provides an Exception which is raised</span>
<span class="sd">    in the event that a class attempts to override a final function.</span>

<span class="sd">    &#39;&#39;&#39;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">classObj</span><span class="p">,</span> <span class="n">functionName</span><span class="p">):</span>
        <span class="sd">&#39;&#39;&#39;</span>
<span class="sd">        * classObj -- The classObj (class, instance, or a string)</span>
<span class="sd">        * functionName -- The name of final function</span>

<span class="sd">        &#39;&#39;&#39;</span>
        <span class="n">message</span> <span class="o">=</span> <span class="s">&quot;The &#39;</span><span class="si">%s</span><span class="s">&#39; function is final and cannot be overridden by &quot;</span> \
            <span class="s">&quot;subclasses of &#39;</span><span class="si">%s</span><span class="s">&#39;!&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">functionName</span><span class="p">,</span> <span class="n">getName</span><span class="p">(</span><span class="n">classObj</span><span class="p">))</span>
        <span class="ne">Exception</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">message</span><span class="p">)</span>

</div>
<div class="viewcode-block" id="InvalidPropertyValueError"><a class="viewcode-back" href="../../_generated/pyamp_exceptions.html#pyamp.exceptions.InvalidPropertyValueError">[docs]</a><span class="k">class</span> <span class="nc">InvalidPropertyValueError</span><span class="p">(</span><span class="ne">Exception</span><span class="p">):</span>
    <span class="sd">&#39;&#39;&#39;The InvalidPropertyValueError is raised in the event that a class</span>
<span class="sd">    property has an unexpected, or invalid, value.</span>

<span class="sd">    &#39;&#39;&#39;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">classObj</span><span class="p">,</span> <span class="n">propName</span><span class="p">,</span> <span class="n">value</span><span class="p">,</span> <span class="n">expected</span><span class="p">):</span>
        <span class="sd">&#39;&#39;&#39;</span>
<span class="sd">        * classObj -- The class obj (class, instance, or string name)</span>
<span class="sd">        * propName -- The name of the invalid property</span>
<span class="sd">        * value -- The invalid property value</span>
<span class="sd">        * expected -- The expected value for the property</span>

<span class="sd">        &#39;&#39;&#39;</span>
        <span class="n">message</span> <span class="o">=</span> <span class="s">&quot;Property &#39;</span><span class="si">%s</span><span class="s">&#39; for &#39;</span><span class="si">%s</span><span class="s">&#39; has an invalid value: </span><span class="si">%s</span><span class="s">, &quot;</span> \
            <span class="s">&quot;expected: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">propName</span><span class="p">,</span> <span class="n">getName</span><span class="p">(</span><span class="n">classObj</span><span class="p">),</span>
                              <span class="nb">str</span><span class="p">(</span><span class="n">value</span><span class="p">),</span> <span class="n">expected</span><span class="p">)</span>
        <span class="ne">Exception</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">message</span><span class="p">)</span></div>
</pre></div>

          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" size="18" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li><a href="../../index.html">pyamp v1.2 documentation</a> &raquo;</li>
          <li><a href="../index.html" >Module code</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2012, Brett Ponsler.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.1.
    </div>
  </body>
</html>